﻿@using Webdiyer.WebControls.Mvc;
@model PagedList<Inspinia_MVC5.Models.Borrow>

@{
    ViewBag.Title = "借阅维护";
}

<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-sm-4">

        @{
            if (Request.QueryString["status"] == null)
            {
                <h2>管理图书借阅</h2>
            }

            else if (Request.QueryString["status"] == "1")
            {
                <h2>办理图书续借</h2>
            }
            else if (Request.QueryString["status"] == "2")
            {
                <h2>办理图书归还</h2>
            }
        }

        <ol class="breadcrumb">
            <li class="active">
                <strong>借阅管理</strong>
            </li>
        </ol>
    </div>
</div>


<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>借阅信息</h5>
                    <div class="ibox-tools">
                        @*@Html.ActionLink("Create New", "Create", null, new { @class = "btn btn-primary btn-xs" })*@
                    </div>
                </div>
                <div class="ibox-content" style="overflow:hidden;">
                    <div class="row">

                        @{

                            if (ViewBag.Admin)
                            {
                                                <div class="col-md-7">
                                                    @using (Ajax.BeginForm("Index", "Borrows", new AjaxOptions { UpdateTargetId = "articles" }, new { @class = "form-inline", style = "float:left" }))
                                                    {
                                                        <div class="input-group" style="width:220px">
                                                            <input type="text" name="name" placeholder="读者姓名" id="exampleInputEmail2" class="form-control"> <span class="input-group-btn">
                                                                <button type="submit" class="btn btn-primary">
                                                                    搜索
                                                                </button>
                                                            </span>
                                                        </div>
                                                        @*<div class="form-group">
                <label for="exampleInputEmail2" class="sr-only">图书名称</label>
                <input type="text" name="name" placeholder="读者姓名" id="exampleInputEmail2" class="form-control">
                <input name="status" type="hidden" value="@ViewBag.Status" />
            </div>
            <button class="btn btn-white" type="submit">检索</button>*@
                                                    }
                                                    @*<form role="form" method="get" action="/Borrows/Index" class="form-inline" style="float:left">
            <div class="form-group">
                <label for="exampleInputEmail2" class="sr-only">图书名称</label>
                <input type="text" name="name" placeholder="读者姓名" id="exampleInputEmail2" class="form-control">
                <input name="status" type="hidden" value="@ViewBag.Status" />
            </div>
            <button class="btn btn-white" type="submit">检索</button>
        </form>*@
                                                    @using (Ajax.BeginForm("Index", "Borrows", new AjaxOptions { UpdateTargetId = "articles" }, new { @class = "form-inline", style = "float:left;padding-left:40px;" }))
                                                    {
                                                        <div class="input-group" style="width:220px">
                                                            <input type="text" name="idcard" placeholder="身份证号" id="exampleInputPassword2" class="form-control"> <span class="input-group-btn">
                                                                <button type="submit" class="btn btn-primary">
                                                                    搜索
                                                                </button>
                                                            </span>
                                                        </div>

                                                        @*<div class="form-group">
                <label for="exampleInputPassword2" class="sr-only">ISBN</label>
                <input type="text" name="idcard" placeholder="身份证号" id="exampleInputPassword2" class="form-control">
                <input name="status" type="hidden" value="@ViewBag.Status" />
            </div>
            <button class="btn btn-white" type="submit">检索</button>*@
                                                    }
                                                </div>

                                    }
                                
                                using (Ajax.BeginForm("Index", "Borrows", new AjaxOptions { UpdateTargetId = "articles" }, new { @class = "form-inline", style = "float:left;padding-left:40px;" }))
                                {
                                    <div class="form-group" id="data_5">
                                        <label class="font-normal">起止时间</label>
                                        <div class="input-daterange input-group" id="datepicker" style="width:250px">
                                            <input type="text" class="input-sm form-control" name="start" value="@ViewBag.Date" />
                                            <span class="input-group-addon">到</span>
                                            <input type="text" class="input-sm form-control" name="end" value="@ViewBag.Date" />

                                        </div>
                                        <input type="submit" class="btn btn-primary dim" value="检索" />
                                    </div>
                                }
                            }
                        </div>
                    @*<form role="form" method="get" action="/Borrows/Index" class="form-inline" style="float:left;padding-left:40px;">
            <div class="form-group">
                <label for="exampleInputPassword2" class="sr-only">ISBN</label>
                <input type="text" name="idcard" placeholder="身份证号" id="exampleInputPassword2" class="form-control">
                <input name="status" type="hidden" value="@ViewBag.Status" />
            </div>
            <button class="btn btn-white" type="submit">检索</button>
        </form>*@
                </div>
                <div class="ibox-content">
                    <div id="articles">
                        @Html.Partial("_BorrowsList", Model)
                    </div>
                    @section Styles {
                        @Styles.Render("~/plugins/awesomeCheckboxStyles")
                        @Styles.Render("~/plugins/clockpickerStyles")
                        @Styles.Render("~/plugins/dateRangeStyles")
                        @Styles.Render("~/Content/plugins/iCheck/iCheckStyles")
                        @Styles.Render("~/Content/plugins/chosen/chosenStyles")
                        @Styles.Render("~/plugins/switcheryStyles")
                        @Styles.Render("~/plugins/jasnyBootstrapStyles")
                        @Styles.Render("~/plugins/nouiSliderStyles")
                        @Styles.Render("~/plugins/dataPickerStyles")
                        @Styles.Render("~/Content/plugins/ionRangeSlider/ionRangeStyles")
                        @Styles.Render("~/plugins/imagecropperStyles")
                        @Styles.Render("~/Content/plugins/colorpicker/colorpickerStyles")
                        @Styles.Render("~/plugins/select2Styles")
                        @Styles.Render("~/plugins/touchSpinStyles")
                        @Styles.Render("~/plugins/tagInputsStyles")
                        @Styles.Render("~/plugins/duallistStyles")
                    }
                    @section scripts
{
                        @{Html.RegisterMvcPagerScriptResource();}
                        @Scripts.Render("~/plugins/dateRange")
                        @Scripts.Render("~/plugins/dataPicker")

                        <script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
                        <script>
                            $('#data_1 .input-group.date').datepicker({
                                todayBtn: "linked",
                                keyboardNavigation: false,
                                forceParse: false,
                                calendarWeeks: true,
                                autoclose: true
                            });

                            $('#data_2 .input-group.date').datepicker({
                                startView: 1,
                                todayBtn: "linked",
                                keyboardNavigation: false,
                                forceParse: false,
                                autoclose: true
                            });

                            $('#data_3 .input-group.date').datepicker({
                                startView: 2,
                                todayBtn: "linked",
                                keyboardNavigation: false,
                                forceParse: false,
                                autoclose: true
                            });






                            $('#data_4 .input-group.date').datepicker({
                                minViewMode: 1,
                                keyboardNavigation: false,
                                forceParse: false,
                                autoclose: true,
                                todayHighlight: true
                            });

                            $('#data_5 .input-daterange').datepicker({
                                keyboardNavigation: false,
                                forceParse: false,
                                autoclose: true
                            });

                            var elem = document.querySelector('.js-switch');
                            var switchery = new Switchery(elem, { color: '#1AB394' });

                            var elem_2 = document.querySelector('.js-switch_2');
                            var switchery_2 = new Switchery(elem_2, { color: '#ED5565' });

                            var elem_3 = document.querySelector('.js-switch_3');
                            var switchery_3 = new Switchery(elem_3, { color: '#1AB394' });

                            var elem_4 = document.querySelector('.js-switch_4');
                            var switchery_4 = new Switchery(elem_4, { color: '#f8ac59' });
                            switchery_4.disable();

                            $('.i-checks').iCheck({
                                checkboxClass: 'icheckbox_square-green',
                                radioClass: 'iradio_square-green',
                            });

                            $('.demo1').colorpicker();

                            var divStyle = $('.back-change')[0].style;
                            $('#demo_apidemo').colorpicker({
                                color: divStyle.backgroundColor
                            }).on('changeColor', function (ev) {
                                divStyle.backgroundColor = ev.color.toHex();
                            });

                            $('.clockpicker').clockpicker();

                            $('input[name="daterange"]').daterangepicker();

                            $('#reportrange span').html(moment().subtract(29, 'days').format('MMMM D, YYYY') + ' - ' + moment().format('MMMM D, YYYY'));

                            $('#reportrange').daterangepicker({
                                format: 'MM/DD/YYYY',
                                startDate: moment().subtract(29, 'days'),
                                endDate: moment(),
                                minDate: '01/01/2012',
                                maxDate: '12/31/2015',
                                dateLimit: { days: 60 },
                                showDropdowns: true,
                                showWeekNumbers: true,
                                timePicker: false,
                                timePickerIncrement: 1,
                                timePicker12Hour: true,
                                ranges: {
                                    'Today': [moment(), moment()],
                                    'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
                                    'Last 7 Days': [moment().subtract(6, 'days'), moment()],
                                    'Last 30 Days': [moment().subtract(29, 'days'), moment()],
                                    'This Month': [moment().startOf('month'), moment().endOf('month')],
                                    'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
                                },
                                opens: 'right',
                                drops: 'down',
                                buttonClasses: ['btn', 'btn-sm'],
                                applyClass: 'btn-primary',
                                cancelClass: 'btn-default',
                                separator: ' to ',
                                locale: {
                                    applyLabel: 'Submit',
                                    cancelLabel: 'Cancel',
                                    fromLabel: 'From',
                                    toLabel: 'To',
                                    customRangeLabel: 'Custom',
                                    daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
                                    monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
                                    firstDay: 1
                                }
                            }, function (start, end, label) {
                                console.log(start.toISOString(), end.toISOString(), label);
                                $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
                            });
                        </script>

                    }



                </div>
            </div>
        </div>
    </div>
</div>



